﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Eis51.CampanyCMS.Model.BaseInfoMng;
using Eis51.CampanyCMS.Business.BaseInfoMng;

namespace Eis51.CampanyCMS.WebUI.Admin.LeaveMsg
{
    public partial class viewmessage : System.Web.UI.Page
    {
        private string Seqno
        {
            get {
                return Request.QueryString["seqno"];
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                InitData();
            }
        }

        private void InitData()
        {
            BaseLeaveMessage obj = BaseLeaveMessageBLL.GetInstance().Get(new BaseLeaveMessage.Key(int.Parse(Seqno)));
            if (obj != null)
            {
                lblContent.Text = obj.Content;
                lblUserName.Text = obj.UserName;
                lblEmail.Text = obj.UserEmail;
                lblTel.Text = obj.Tel;
                lblCreateDate.Text = obj.CreateDate.ToString();
                txtOption.Text = obj.MyOpinion;
            }
        }

        protected void btnSave_Click(object sender, EventArgs e)
        {
            BaseLeaveMessage obj = BaseLeaveMessageBLL.GetInstance().Get(new BaseLeaveMessage.Key(int.Parse(Seqno)));
            if (obj == null)
            {
                obj = new BaseLeaveMessage();
            }
            obj.IsView = 1;
            obj.MyOpinion = txtOption.Text;
            BaseLeaveMessageBLL.GetInstance().Submit(obj);
            btnReturn_Click(null, null);
        }

        protected void btnReturn_Click(object sender, EventArgs e)
        {
            Response.Redirect("~/admin/LeaveMsg/list.aspx");
        }
    }
}
